const nconf = require('nconf')
const path = require('path')

nconf
  .argv()
  .env()
  .file({
    file: path.join('.', 'config', 'config.yml'),
    format: require('nconf-yaml')
  })

const getConf = (key) => {
  return nconf.get(key)
}

const setConf = (key, value) => {
  return nconf.set(key, value)
}

const saveConf = () => {
  return nconf.save()
}

module.exports = {
  getConf,
  setConf,
  saveConf
}
